Hi,
/*
* Build up Permission out of AccessRec
*/
Permission buildPermission(AccessRec ar) {
Permission p
if(read(ar)) {
p = read
}
if(create(ar)) {
p = p | create
}
if(modify(ar)) {
p = p | modify
}
if(delete(ar)) {
p = p | delete
}
if(control(ar)) {
p = p | control
}
}
for ar in masterAd do {
Permission p = buildPermission(ar)
setDef(m, derivedAd, p, username(ar))
}
MichaelGeorg - Thu Apr 19 04:25:53 EDT 2012 |
Re: Get Permission of AccessRec
-Louie |
Re: Get Permission of AccessRec llandale - Thu Apr 19 12:44:39 EDT 2012
-Louie
Also that's not what I hope for, thank you Louie for the information.
/*
* Build up Permission out of AccessRec
*/
Permission buildPermission(AccessRec ar) {
Permission p = none
if(read(ar)) {
p = read
}
if(create(ar)) {
p = p | create
}
if(modify(ar)) {
p = p | modify
}
if(delete(ar)) {
p = p | delete
}
if(control(ar)) {
p = p | control
}
return p
}
|
Re: Get Permission of AccessRec MichaelGeorg - Fri Apr 20 05:40:50 EDT 2012
Also that's not what I hope for, thank you Louie for the information.
/*
* Build up Permission out of AccessRec
*/
Permission buildPermission(AccessRec ar) {
Permission p = none
if(read(ar)) {
p = read
}
if(create(ar)) {
p = p | create
}
if(modify(ar)) {
p = p | modify
}
if(delete(ar)) {
p = p | delete
}
if(control(ar)) {
p = p | control
}
return p
}
Just as a matter of style, I think the following is easier to understand more quickly:
Permission buildPermission(AccessRec ar) {
if(null ar) then return(none Permission)
Permission p = none
if(read(ar)) then p = p | read
if(create(ar)) then p = p | create
if(modify(ar)) then p = p | modify
if(delete(ar)) then p = p | delete
if(control(ar)) then p = p | control
return p
}
bool hasPermission(AccessRec ar, Permission p)
{ // Does the Access rec provide the specified Permission?
// e.g. if(hasPermission(ar, modify)) then the ar has 'modify' permission
Permission psn = buildPermission(ar)
return((psn & p)==p)
}
|